package com.cskaoyan.service.user.impl;

import com.cskaoyan.bean.vo.DashboardVo;
import com.cskaoyan.mapper.MarketGoodsMapper;
import com.cskaoyan.mapper.MarketGoodsProductMapper;
import com.cskaoyan.mapper.MarketOrderMapper;
import com.cskaoyan.mapper.MarketUserMapper;
import com.cskaoyan.service.user.DashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author jzp
 * @since 2022/11/19 16:45
 */
@Service
public class DashboardServiceImpl implements DashboardService {
    @Autowired
    MarketUserMapper marketUser;
    @Autowired
    MarketGoodsMapper marketGoods;
    @Autowired
    MarketGoodsProductMapper marketGoodsProduct;
    @Autowired
    MarketOrderMapper marketOrder;

    @Override
    public DashboardVo countNum() {
        long userTotal = marketUser.countByExample(null);
        long goodsTotal = marketGoods.countByExample(null);
        long goodsProductTotal = marketGoodsProduct.countByExample(null);
        long orderTotal = marketOrder.countByExample(null);
        DashboardVo dashboardVo = new DashboardVo(goodsTotal, userTotal, goodsProductTotal, orderTotal);

        return dashboardVo;
    }
}
